<template>
  <div class="admin-bg">
    <div class="admin-layout">
      <el-container style="height: 100vh; background: transparent;">
        <el-aside width="200px" class="aside">
          <div class="logo">后台管理</div>
          <el-menu :default-active="activeMenu" router>
            <el-menu-item index="/admin/anime">动漫管理</el-menu-item>
            <el-menu-item index="/admin/category">分类管理</el-menu-item>
            <el-menu-item index="/admin/user">用户管理</el-menu-item>
          </el-menu>
        </el-aside>
        <el-container>
          <el-header class="header">
            <div class="header-title">管理后台</div>
            <el-button type="danger" @click="onLogout">退出登录</el-button>
          </el-header>
          <el-main class="main">
            <router-view />
          </el-main>
        </el-container>
      </el-container>
    </div>
  </div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
const activeMenu = route.path
const onLogout = () => {
  localStorage.removeItem('token')
  router.push('/login')
}
</script>

<style scoped>
.admin-bg {
  min-height: 100vh;
  width: 100vw;
  position: fixed;
  left: 0;
  top: 0;
  z-index: -1;
  overflow: hidden;
}
.admin-bg::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  background: url('/src/assets/001.png') center center/cover no-repeat;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  filter: brightness(0.85);
}
.admin-layout {
  min-height: 100vh;
  background: rgba(30, 32, 40, 0.20);
  border-radius: 38px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  margin: 0 auto;
  max-width: 1400px;
  padding: 24px 0;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(2px);
}
.logo {
  font-size: 22px;
  font-weight: bold;
  color: #6366f1;
  text-align: center;
  margin: 24px 0 32px 0;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(245,247,250,0.01);
  padding: 0 24px;
  height: 60px;
  box-shadow: 0 2px 8px rgba(16, 15, 15, 0.33);
  backdrop-filter: blur(1.5px);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.header-title {
  font-size: 18px;
  color: #6366f1;
  font-weight: bold;
}
.main {
  background: rgb(132, 173, 255,0);
  border-radius: 32px;
  margin: 16px;
  padding: 24px;
  min-height: 600px;
  box-shadow: 0 2px 16px rgba(251, 251, 251, 0.1);
}
.aside {
  background: rgba(255,255,255,0.01);
  box-shadow: 2px 0 8px rgba(0,0,0,0.33);
  backdrop-filter: blur(1.5px);
  border-top-left-radius: 0;
  border-bottom-left-radius: 32px;
}
:deep(.el-menu),
:deep(.el-menu--vertical) {
  background: transparent !important;
  border: none !important;
  border-right: none !important;
  box-shadow: none !important;
}
:deep(.el-menu-item) {
  background: rgba(183, 183, 183, 0.5) !important;
  transition: background 0.2s;
  
}
:deep(.el-menu-item.is-active),
:deep(.el-menu-item:hover) {
  background: rgba(199, 199, 199, 0.4) !important;
  box-shadow: 0 2px 16px rgba(251, 251, 251, 0.2);
}
</style> 